<!-- 用户 -->

<template>
  <FormSlot :label="`${CORE.MAP.ORGAN}领导`" bind="leaderId" :tip="`请选择${CORE.MAP.ORGAN}领导`">
    <div>
      <span v-if="one.leaderId" class="el-button--text" @click="toOpen">
        {{ one.leaderName }}{{ one.leaderPhone ? `(${one.leaderPhone})` : '' }}
      </span>

      <span v-if="!isShow">
        <BtnText v-if="one.leaderId" title="清除" @click="toClear" />
        <BtnPrimary v-else title="选择" @click="toOpen" />
      </span>
    </div>

    <EasyModal v-model="easyVisible" :title="`选择${CORE.MAP.ORGAN}领导`" medium @submit="toSubmit" @close="toReset">
      <ChooseUserOne :obj="obj" bind="user" :organId="one.id" />
    </EasyModal>
  </FormSlot>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import MyUser from '@admin/views/System/User/UserOrgan/FormAdd/MyUser'

// ============================== 导出组件 ============================== //

export default CORE.extend(MyUser, {
  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb()],

  /**
   * 监听属性 (深度 deep 首次 immediate)
   */
  watch: {
    /**
     * 监听单项
     */
    one() {
      this.toReset()
    },
  },
})
</script>
